<?php
namespace app\admin\controller;
use think\Db;
use app\common\controller\AdminBase;
class Config extends AdminBase {
    public function index(){
        $data=Db::name('Config')->find();
        if(!empty($data)){
            $this->assign('list',$data);
        }       
        return $this->fetch();
    }
    public function setting(){
        $data=input('post.');
        if(empty($data['id'])){
            $data['id']=null;
            $id=Db::name('config')->insert($data,false,true);
            if($id){
                return ['msg'=>"添加成功！",'status'=>true];
            }else{
                return ['msg'=>"添加失败！",'status'=>true];
            }            
        }else{
            $id=Db::name('config')->update($data,false,true);
           return ['msg'=>"更新成功！",'status'=>true];	
        }
    }
}